package com.sunnada.edu.system.pub.common;

import java.io.File;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.multipart.MultipartFile;

import com.alibaba.fastjson.JSONObject;

/** 
 * Plupload是一个上传插件。 
 * 这是一个bean类,主要存储Plupload插件上传时需要的参数。 
 * 属性名不可随意改动. 
 * 这里主要使用MultipartFile文件上传方法 
 */  
public class Plupload {  
      
    /**文件临时名或原名*/  
    private String name;
    /**总的块数*/  
    private int chunks = -1;  
    /**当前块数（从0开始计数）*/  
    private int chunk = -1;  
    /**HttpServletRequest对象，不能直接传入进来，需要手动传入*/  
    private HttpServletRequest request;  
    /**保存文件上传信息，不能直接传入进来，需要手动传入*/  
    private MultipartFile multipartFile;  
    /**是否是素材上传，素材上传要做特殊验证通过后才上传，0、是；1、不是*/
    private String isMaterial;
    /**最终上传完毕的文件*/
    private File uploadFile;
    /**屏幕类型*/
    private String screenType;
    /**文件原名*/
    private String fileName;
    /**设置错误时返回的json*/
    private JSONObject errorJson;
    /**程序名称*/
    private String proName;
    /**程序版本**/
    private String proVersion;
    /**广告类型*/
    private String adType;
    
	public String getProName() {
		return proName;
	}

	public void setProName(String proName) {
		this.proName = proName;
	}

	public String getProVersion() {
		return proVersion;
	}

	public void setProVersion(String proVersion) {
		this.proVersion = proVersion;
	}

	public String getName() {  
        return name;  
    }  
  
    public void setName(String name) {  
        this.name = name;  
    }  
  
    public int getChunks() {  
        return chunks;  
    }  
  
    public void setChunks(int chunks) {  
        this.chunks = chunks;  
    }  
  
    public int getChunk() {  
        return chunk;  
    }  
  
    public void setChunk(int chunk) {  
        this.chunk = chunk;  
    }  
  
    public HttpServletRequest getRequest() {  
        return request;  
    }  
  
    public void setRequest(HttpServletRequest request) {  
        this.request = request;  
    }  
  
    public MultipartFile getMultipartFile() {  
        return multipartFile;  
    }  
  
    public void setMultipartFile(MultipartFile multipartFile) {  
        this.multipartFile = multipartFile;  
    }

	public String getIsMaterial() {
		return isMaterial;
	}

	public void setIsMaterial(String isMaterial) {
		this.isMaterial = isMaterial;
	}

	public File getUploadFile() {
		return uploadFile;
	}

	public void setUploadFile(File uploadFile) {
		this.uploadFile = uploadFile;
	}

	public String getScreenType() {
		return screenType;
	}

	public void setScreenType(String screenType) {
		this.screenType = screenType;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public JSONObject getErrorJson() {
		return errorJson;
	}

	public static JSONObject setErrorJson(int errorCode, String errorMsg) {
		JSONObject json = new JSONObject();
		json.put("jsonrpc","2.0");  
		JSONObject jsonChild = new JSONObject();
		jsonChild.put("code",errorCode);  
		jsonChild.put("message",errorMsg);  
        json.put("error", jsonChild);  
        json.put("id","id");  
        return json;  
	}

	public String getAdType() {
		return adType;
	}

	public void setAdType(String adType) {
		this.adType = adType;
	}

      
}  